using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WinServicesSample
{
    public sealed partial class ServiceBLL
    {
        static object lockObj = new object();
        public static void RunServiceBLL()
        {
            lock (lockObj)
            {
                try
                {
                     WriteLog();
                }
                catch (System.Data.Entity.Validation.DbEntityValidationException ex)
                {
                    foreach (var validationErrors in ex.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            LogHandler.WriteLog("Property: " + validationError.PropertyName + " throws Error: " + validationError.ErrorMessage);
                        }
                    }
                }
            }
        }

        private static void WriteLog()
        {

            LogHandler.WriteLog("********************");
            LogHandler.WriteLog("current time is:" + DateTime.Now.ToLongTimeString());
        }
    }
}
